Modern C for Absolute Beginners by Slobodan Dmitrović

Modern C for Absolute Beginners by Slobodan Dmitrović

Author:Slobodan Dmitrović
Language: eng
Format: epub
ISBN: 9781484266434
Publisher: Apress


typedef struct

{

char *name;

int age;

double salary;

} TPerson;

int main(void)

{

TPerson o;

o.name = "Sample Name";

o.age = 35;

o.salary = 2500.00;

printf("Name: %s
", o.name);

printf("Age: %d
", o.age);

printf("Salary: %.2f
", o.salary);

}

Output:Name: John Doe

Age: 35

Salary: 2500.00

22.3 Structure Initialization

Write a program that defines a structure. The structure has the char[], int, and double fields. Declare and initialize a variable of this structure type. Print out the values:#include <stdio.h>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.